﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using Forum.Entity.Member;
using Frame.Lib.Core.Base;
using Frame.Lib.Utilities;


namespace Forum.DAL.Member
{
    public class MemberBaseDAL:BaseDAL
    {
        
        public List<MemberBaseInfo> GetList(List<string> loginNames)
        {
            string sql = " select * from " + TableName.MemberBase + "  where LoginName in (" + ConvertUtil.ConvertToDbStr(loginNames) + ")";
            List<MemberBaseInfo> list = dbOper.Query<MemberBaseInfo>(sql);
            return list;

        }

        public List<MemberBaseInfo> GetList(List<int> memberIDs)
        {
            string sql = " select * from "+ TableName.MemberBase + "  where ID in (" + ConvertUtil.ConvertToDbStr(memberIDs) + ")";
            List<MemberBaseInfo> list = dbOper.Query<MemberBaseInfo>(sql);
            return list;
        }

        public MemberBaseInfo GetInfoByLoginName(string loginName)
        {
            string sql = "select * from " + TableName.MemberBase + " where LoginName =@p0";
            List<MemberBaseInfo> list = dbOper.Query<MemberBaseInfo>(sql, loginName);
            if (list.Count > 0)
            {
                return list.First();
            }
            else
            {
                return null;
            }
        }
    }
}
